package org.uniport.dao.proxy;

import org.uniport.dao.IUserDAO;
import org.uniport.dao.impl.UserDAOImpl;
import org.uniport.dbc.DatabaseConnection;
import org.uniport.vo.User;

public class UserDAOProxy implements IUserDAO{
	
	private DatabaseConnection dbc= null;
    private IUserDAO dao = null; //problem?
    public UserDAOProxy(){
            try{
                    this.dbc = new DatabaseConnection();
            }catch(Exception e){
                    e.printStackTrace();
            }
            this.dao = new UserDAOImpl(dbc.getConnection());
    }
	
	public boolean addUser(User user) throws Exception {
		boolean flag = false;
        try{
                flag = this.dao.addUser(user);
        }catch(Exception e){
                throw e;
        }finally{
                this.dbc.close();
        }
        return flag;
	}

}
